#include "thread_pool.h"
void thread_HandleMessage(task_t * task)
{
    int peerfd = task->peerfd;
    int len = -1;
    recvn(peerfd,&len,4);
    printf("thread recv len is %d\n",len);
    CmdType type = (CmdType) -1;
    recvn(peerfd,&type,4);
    printf("thread recv type is %d\n",type);
    task->type = type;
    recvn(peerfd,task->data,len);
    printf("task->data is %s\n",task->data);
    thread_do_task(task);    
}
void thread_do_task(task_t * task)
{
    switch(task->type){
    case CMD_TYPE_GETS:
        puts("enter gets");
        getsCommand(task);    
        break;
    case CMD_TYPE_PUTS:
        putsCommand(task);
        break;
    case CMD_TYPE_QUIT:
        quitCommand(task);
        break;
    }
}
